<script type="text/javascript" src="/js/admin/jquery.syntaxhighlighter.min.js"></script>
<div class="block">
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <h2>Tạo Form</h2>
    </div>

    <div class="block_content">        
        <form action="" method="post">
            <?php
            $html = '';
            if (!empty($fields)) {

                foreach ($fields as $key => $field) {
                    $field = trim($field);
                    switch ($types[$key]) {
                        case 'text':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<label>' . $lables[$key] . ':</label><br />' . "\n";
                            $html .= "\t" . '<input type="text" class="text small" name="' . $field . '" value="" id="' . $field . '" />' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'file':
                            $html .= '<p class = "fileupload">' . "\n";
                            $html .= "\t" . '<label>' . $lables[$key] . ':</label><br />' . "\n";
                            $html .= "\t" . '<input type="file" id="' . $field . '" />' . "\n";
                            $html .= "\t" . '<span id="uploadmsg">Jpg, gif, png and pdf files only. Max size 3mb.</span>' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'textarea':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<label>' . $lables[$key] . ':</label><br />' . "\n";
                            $html .= "\t" . '<textarea rows="5" cols="50" name="' . $field . '" id="' . $field . '"></textarea>' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'radio':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<input type="radio" class="radio" name="' . $field . '" id="' . $field . '" />' . "\n";
                            $html .= "\t" . '<label for="' . $field . '">' . $lables[$key] . '</label>' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'checkbox':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<input type="checkbox" class="checkbox" name="' . $field . '" id="' . $field . '" />' . "\n";
                            $html .= "\t" . '<label for="' . $field . '">' . $lables[$key] . '</label>' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'date':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<label>' . $lables[$key] . ':</label>' . "\n";
                            $html .= "\t" . '<input type="text" class="text date_picker" name="' . $field . '" id="' . $field . '" />' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'editor':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<label>' . $lables[$key] . ':</label><br />' . "\n";
                            $html .= "\t" . '<textarea class="wysiwyg" name="' . $field . '" id="' . $field . '"></textarea>' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                        case 'combobox':
                            $html .= '<p>' . "\n";
                            $html .= "\t" . '<label>' . $lables[$key] . ':</label> <br />' . "\n";
                            $html .= "\t\t" . '<select class="styled" name="' . $field . '" id="' . $field . '">' . "\n";
                            $html .= "\t\t\t" . '<option value="">-- Chọn ' . $lables[$key] . '--</option>' . "\n";
                            $html .= "\t\t" . '</select>' . "\n";
                            $html .= '</p>' . "\n";
                            break;
                    }
                }
                $html .= '<p>' . "\n";
                $html .= "\t" . '<input type="submit" class="submit small" value="Submit" />' . "\n";
                $html .= "\t" . '<input type="button" class="submit mid" value="Cancel" />' . "\n";
                $html .= '</p>' . "\n";
            }
            echo $html;
            ?>            
        </form>        
        <pre class="language-html">
            <?php echo str2str($html); ?>
        </pre>
    </div>
    <div class="bendl"></div>
    <div class="bendr"></div>
</div>
<script type="text/javascript">$.SyntaxHighlighter.init();</script>
